    //申请记录页面Url
    __str_apply_url = "https://c.liepin.com/job/record/apply";
  
    //已查看记录页面Url
    __str_view_url = "https://c.liepin.com/resume/viewed-log";
  
    //收藏记录页面Url
    __str_fav_url = "https://c.liepin.com/job/record/favorite";

    //职位搜索页面Url
    __str_jobs_url = "https://www.liepin.com/zhaopin/";

    //每个页面加载的样式
    __css={
      'apply' :`
            /*申请页面样式调整start */
            .shNIp .cPU5B .LckgR {margin-top: 2px !important;}

            .list-item-box{margin-top: 2px !important; font-size: 14px !important;}
            .list-item-box span{font-size: 14px !important;}

            .job-card-pc-container{padding: 5px 5px 5px 20px !important;}
            .asider-box{display: none !important;}
            .record-list-box{width: 1100px !important;}

            .job-detail-box >div:nth-of-type(1) {padding-top: 0px !important;}
            .job-detail-box  >a >div:nth-of-type(2) {display:none !important; float: left !important;}
            .job-detail-box  >a >div:nth-of-type(1) {float: left !important; font-size: 14px !important;}
            .job-detail-box  >a >div >div >div:nth-of-type(1) {font-size: 14px !important;}

            .job-card-right-box >div >div >div:nth-of-type(1) {height:20px !important; display: none !important;}
            .job-card-right-box >div >div >div:nth-of-type(2) {padding-top:0px !important;}
            .job-card-right-box >div >p:nth-of-type(1) {line-height:20px !important;}

            .state-info-popover{float: left !important; }
            .state-info-popover div{float: left !important; }

            .job-detail-box .ellipsis-1{font-size: 14px !important;}

            .recruiter-info-box{padding-bottom: 0px !important;}
            .chat-btn-box{padding-top: 0px !important;}

            /*翻页页面样式调整*/
            .record-container >div{width:100% !important;}
            .apply-record-container{position:relative  !important ;top:0px  !important ;left:0px !important ;}
            .apply-record-container >div{position:absolute !important ;top:-50px  !important ;left:500px !important ;margin-top: 0px !important;}
            /*申请页面样式调整end */
      `,
      'view' :`
          /*谁查看我页面样式调整start */


            #resume-resumeviewedlog-new .main-wrap .header {
               width:1200px !important; 
            }


          .aside-wrap-new{display:none}  /*关闭侧边栏 */
          .resume-item-content {
            width:100% !important;
            padding: 5px 5px 0px !important;
            clear: both !important;
            display: block !important;
            height: 60px !important;
            margin-bottom: 5px !important; 
          }

          .view-job-card-container .view-job-card-content {
            width: 320px !important; 
            height:auto !important;
            padding: 0px !important;
            margin-right: -100px !important; 
          }

          .view-job-card-container .job-labels-box {
          margin-top: 0px !important;
          }

          .view-job-card-container .job-detail-header-box .job-title-box {
            font-size:14px !important; 
          }

          .view-job-card-container .view-job-card-hr {
            border-top:0px solid #e6eaf1 !important; 
          }

          .ant-btn-round.ant-btn-lg {
            border-radius: 20px !important;
            font-size: 12px !important;
            height: 30px !important;
            padding: 5px 5px !important;
          }

          .view-job-card-container {
            float: right !important;
            width: 320px !important;
            position: relative !important;
            height:50px !important;
            padding-left:10px !important;
          }

          .resume-item-hr-content {
            float: left !important;
            margin-right: -250px !important;
            position: absolute !important;
          }

          .resume-item-desc {
            width:350px !important
          }

          .list-pagination-box {
            position: absolute !important;
            top: -10px !important;
            left: 100px !important;
          }

          .list-pagination-box .resume-viewed-log-tips {
            margin-bottom:0px !important;
          }

          .view-job-card-container .job-detail-header-box .job-salary {
          font-size:12px !important; 
          }

          /*谁查看我页面样式调整end */
          `,
      'fav' :`
            /*收藏页面样式调整start */
            .shNIp .cPU5B .LckgR {margin-top: 2px !important;}

            .job-card-pc-container{padding: 5px 5px 5px 20px !important;}
            .asider-box{display: none !important;}
            .record-list-box{width: 1100px !important;}

            .job-detail-box >div:nth-of-type(1) {padding-top: 0px !important;}
            .job-detail-box  >a >div:nth-of-type(2) {display:none !important; float: left !important;}
            .job-detail-box  >a >div:nth-of-type(1) {float: left !important; font-size: 14px !important;}
            .job-detail-box  >a >div >div >div:nth-of-type(1) {font-size: 14px !important;}

            .job-detail-box .ellipsis-1{font-size: 14px !important;}
            .job-card-right-box div {float: left !important;height: 30px !important;}
            .job-card-right-box > div >div:nth-of-type(1)  {display: none !important;}

            .recruiter-info-box{padding-bottom: 0px !important;}
            .chat-btn-box{padding-top: 0px !important;}

            /*翻页页面样式调整*/
            .favorite-record-container{position: relative !important ;}
            .favorite-record-container >div:nth-of-type(1)  {
              position:absolute !important ;top:-100px !important; left:500px !important;
            } 
            /*收藏页面样式调整end */
          `,
      'jobs' :`
          /*职位列表页面样式调整start */
          .content-left-section{width:1200px !important;}
          .content-right-section{display:none !important;}


          .job-list-box >div {margin-bottom: 2px !important;}

          .job-card-pc-container{padding: 5px 5px 5px 20px !important;}
          .asider-box{display: none !important;}
          .record-list-box{width: 1100px !important;}

          .job-detail-box >div:nth-of-type(1) {padding-top: 0px !important;}
          .job-detail-box  >a >div:nth-of-type(2) {display:none !important; float: left !important;}
          .job-detail-box  >a >div:nth-of-type(1) {float: left !important; font-size: 14px !important;}
          .job-detail-box  >a >div >div >div:nth-of-type(1) {font-size: 14px !important;}

          .job-detail-box .ellipsis-1{font-size: 14px !important;}
          .job-card-right-box div {float: left !important;height: 30px !important;}
          .job-card-right-box > div >div:nth-of-type(1)  {display: none !important;}

          .recruiter-info-box{padding-bottom: 0px !important;}
          .chat-btn-box{padding-top: 0px !important;}

          /*翻页页面样式调整*/
          .favorite-record-container{position: relative !important ;}
          .favorite-record-container >div:nth-of-type(1)  {
            position:absolute !important ;top:-100px !important; left:500px !important;
          } 
          /*职位列表页面样式调整end */
    `,
}

  // 发送带有参数的消息到后台脚本,获取cookie,start 
  const message = {
    action: "getCookies",
    params: {
      url: "https://liepin.com/"
    }
  };

  chrome.runtime.sendMessage(message, function(response) {
    if (response && response.cookies) {

      var __cookies = {};
      //console.log("Received cookies:", response.cookies);
      response.cookies.forEach(cookie => {
        __cookies[cookie.name] = cookie.value;
      });

      __cookies = __cookies;

    } else {
      console.log("No cookies received.");
    }
  });
    
get_headers = function(page_num){

  return {
    "headers": {
      "accept": "application/json, text/plain, */*",
      "accept-language": "zh-CN,zh;q=0.9",
      "content-type": "application/x-www-form-urlencoded",
      "sec-ch-ua": "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"",
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": "\"Windows\"",
      "sec-fetch-dest": "empty",
      "sec-fetch-mode": "cors",
      "sec-fetch-site": "same-site",
      "x-client-type": "web",
      "x-fscp-bi-stat": "{\"location\": \"000000\"}",
      "x-fscp-fe-version": "",
      "x-fscp-std-info": "{\"client_id\": \"0000000\"}",
      "x-fscp-trace-id": "0000000",
      "x-fscp-version": "1.1",
      "x-requested-with": "XMLHttpRequest",
      "x-xsrf-token": "0000000"
    },
    "referrer": "https://c.liepin.com/",
    "body": "curPage="+page_num +"&pageSize=10",
    "method": "POST",
    "mode": "cors",
    "credentials": "include"
  }
}

parse_jobs_info=function(result){
  let arrRstList  = [];

  for(var i=0; i< result.length; i++){
      var item = result[i];

      item_info      = {
        job_id: item.job.jobId,
        job_name: item.job.title,
        job_link: item.job.link,
        company_id: item.comp.compId,
        company_name: item.comp.compName,
        company_link: item.comp.link,
        publish_date: null,
        update_date: parse_date_from_str(item.job.refreshTime),
      }

      arrRstList.push(item_info);
  }

  return arrRstList;
}

parse_apply_info=function(result){
  let arrRstList  = [];

  for(var i=0; i< result.length; i++){
      var item = result[i];

      item_info      = {
        job_id: item.job.jobId,
        job_name: item.job.title,
        job_link: item.job.link,
        company_id: item.comp.compId,
        company_name: item.comp.compName,
        company_link: item.comp.link,

        apply_id: item.applyInfo.applyId,
        finished: item.job.finished,
        feedback:item.applyInfo.applyStatusList,
        apply_status:item.applyInfo.applyStautsDesc,
        apply_date: timestamp_to_date(item.applyInfo.statusTime),
        publish_date: parse_date_from_str(item.job.refreshTime),
        update_date: null
      }

      arrRstList.push(item_info);
  }

  return arrRstList;
}

get_apply_info= function(page_num =0 ){

    return new Promise((resolve, reject) => {

      // 定义要请求的 URL
      const url = 'https://api-c.liepin.com/api/com.liepin.capply.pc.apply-list?src=get_apply_info';

      showInfo('获取申请记录：第:'+page_num +"页","info");
      console.log('获取申请记录：第:'+page_num +"页");

      fetch(url, get_headers(page_num))
      .then(response => {
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.json(); // 解析响应体为 JSON 对象
      })
      .then(result => {

        var totalCount  = result.data.totalCount;
        var pageSize    = result.data.pageSize;
        var result      = result.data.list;
        var arrRstList  = parse_apply_info(result);
    
        //递归获取下一页数据
        if(pageSize * page_num < totalCount ){

          get_apply_info(page_num + 1)
          .then(result => {
            arrRstList =  arrRstList.concat(result)
            resolve(arrRstList);
          })
          .catch(error => {
            console.error(error);
            reject([]);
          });
        }else{
          showInfo("完成", "success");
          resolve(arrRstList);
        }
      })
      .catch(error => {
        console.error('请求失败:', error);
      });

    });

}

parse_view_info=function(result){
  let arrRstList  = [];

  for(var i=0; i< result.length; i++){
      var item = result[i];
      item_info      = {
        job_id: item.userId,
        job_name: item.name,
        job_link: item.link,
        company_id: item.compId,
        company_name: item.compName,
        last_view_date: timestamp_to_date(item.viewTime),
      }
      arrRstList.push(item_info);
  }

  return arrRstList;
}

get_view_info= function(page_num =0 ){

  return new Promise((resolve, reject) => {

    // 定义要请求的 URL
    const url = 'https://api-c.liepin.com/api/com.liepin.cresume.user.resume-viewed-page?src=get_view_info';

    showInfo('获取查看记录：第:'+page_num +"页","info");
    console.log('获取查看记录：第:'+page_num +"页");

    fetch(url, get_headers(page_num))
    .then(response => {
      if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
      }
      return response.json(); // 解析响应体为 JSON 对象
    })
    .then(result => {
      var totalCount  = result.data.totalCount;
      var pageSize    = result.data.pageSize;

      var result      = result.data.list;
      let arrRstList  = parse_view_info(result);

      //递归获取下一页数据
      if(pageSize * page_num < totalCount ){

        get_view_info(page_num + 1)
        .then(result => {
          arrRstList =  arrRstList.concat(result)
          resolve(arrRstList);
        })
        .catch(error => {
          console.error(error);
          reject([]);
        });
      }else{
        showInfo("完成", "success");
        resolve(arrRstList);
      }
    })
    .catch(error => {
      console.error('请求失败:', error);
    });

  });

}

//解析收藏记录
parse_fav_info=function(result){
  let arrRstList  = [];
  for(var i=0; i< result.length; i++){
      var item = result[i];
      item_info      = {
        job_id: item.jobCardDto.job.jobId,
        job_name: item.jobCardDto.job.title,
        job_link:  item.jobCardDto.job.pcLink,
        company_id:  item.jobCardDto.comp.compId,
        company_name:  item.jobCardDto.comp.compName,
        company_link:  item.jobCardDto.comp.pcLink,
        publish_date:  parse_date_from_str(item.jobCardDto.job.refreshTime),
        app_date: timestamp_to_date(item.favoriteTime),
      }
      arrRstList.push(item_info);
  }

  return arrRstList;
}

get_fav_info= function(page_num =1 ){

    return new Promise((resolve, reject) => {

      // 定义要请求的 URL
      const url = 'https://api-c.liepin.com/api/com.liepin.c.job-favorite.get-favorite-job-page?src=get_fav_info';

      showInfo('获取收藏记录：第:'+page_num +"页","info");
      console.log('获取收藏记录：第:'+page_num +"页");

      fetch(url, get_headers(page_num))
      .then(response => {
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.json(); // 解析响应体为 JSON 对象
      })
      .then(result => {
        var totalCount  = result.data.totalCnt;
        var pageSize    = 20;
  
        var result      = result.data.datas;
        let arrRstList  = parse_fav_info(result);
  
        //递归获取下一页数据
        if(pageSize * page_num < totalCount ){
  
          get_fav_info(page_num + 1)
          .then(result => {
            arrRstList =  arrRstList.concat(result)
            resolve(arrRstList);
          })
          .catch(error => {
            console.error(error);
            reject([]);
          });
        }else{
          showInfo("完成", "success");
          resolve(arrRstList);
        }
      })
      .catch(error => {
        console.error('请求失败:', error);
      });


    });
}

refresh_apply_info = async function(){
 
  get_apply_info(0)
  .then(result => {

    let json_items ={};
    for (let i = 0; i < result.length; i++) {
      json_items[result[i].job_id] = result[i];
    }

    console.log(result)
    console.log(JSON.stringify(json_items));

    chrome.storage.local.set({'liepin_apply_list': json_items}, function() {
      console.log('liepin_apply_list Save to chrome.storage.local.liepin_apply_list');
    });

    jQuery("#job_helper_list_apply .monitor_num").html(result.length);

  })
  .catch(error => {
    console.error(error);
  });
}

refresh_view_info = async function(){
  
    get_view_info(1)
    .then(result => {

      let json_items ={};
      for (let i = 0; i < result.length; i++) {
        json_items[result[i].company_id] = result[i];
      }

      console.log(result)
      console.log(JSON.stringify(json_items));

      chrome.storage.local.set({'liepin_view_list': json_items}, function() {
        console.log('liepin_view_list Save to chrome.storage.local.liepin_view_list');
      });

      jQuery("#job_helper_list_view .monitor_num").html(result.length);

    })
    .catch(error => {
      console.error(error);
    });
}

refresh_fav_info = async function(){
  
  get_fav_info(1)
  .then(result => {

    let json_items ={};
    for (let i = 0; i < result.length; i++) {
      json_items[result[i].job_id] = result[i];
    }

    console.log(result)
    console.log(JSON.stringify(json_items));

    chrome.storage.local.set({'liepin_fav_list': json_items}, function() {
      console.log('liepin_fav_list Save to chrome.storage.local.liepin_fav_list');
    });

    jQuery("#job_helper_list_fav .monitor_num").html(result.length);

  })
  .catch(error => {
    console.error(error);
  });
}

//扩展收藏页面功能
fav_page_extend = function(result){

  if(document.location.href.indexOf(__str_fav_url) < 0 ){
    return;
  }

  //遍历申请列表，增加申请提示信息
  jQuery(".j_joblist .e").each(function(){

    let job_id = jQuery(this).attr("id").replace("collection_", "");

    if(__arr_apply_list[job_id]){

      var apply_date  = __arr_apply_list[job_id].apply_date;
      var apply_status = __arr_apply_list[job_id].apply_status;
      var feedback = __arr_apply_list[job_id].feedback;

      var strHtml = '<span class="job_helper_box_applyed">已申请(：' + apply_date + ':'+ apply_status +')</span>';
          strHtml += '<div class="job_helper_box_tips"><div class="job_helper_box_tips_content">'+ feedback  +'</div></div>';
          strHtml += '<div style="clear:both"></div>';
          jQuery(this).find(".jname ").after(strHtml);

          const popoverTrigger = jQuery(this).parent().find(".job_helper_box_applyed").eq(0)[0];
          const popoverContent = jQuery(this).parent().find(".job_helper_box_tips").eq(0)[0].outerHTML;

          // 初始化 Popover，将内容设置为隐藏元素的 HTML
          const popover = new bootstrap.Popover(popoverTrigger, {
              content: popoverContent,
              html: true,
              trigger: 'manual' // 设置为手动触发
          });

          jQuery(popoverTrigger).hover(
            function() {
                popover.show();
              },
            function() {
                popover.hide();
            }
          );
    }
  });

    //增加全选按钮
    var strHtml = `
    <input type="checkbox" id="job_helper_box_select_all"  class="form-check-input"  value="1">
    <label for="job_helper_box_select_all" class="form-check-label">全选</label>  `;

    
    jQuery("#job_helper_action_btn").after(strHtml);

    jQuery("#job_helper_box_select_all").click(function(){

        var bChecked = jQuery(this).is(":checked");

        if(bChecked){
          jQuery(".j_joblist .e").addClass("on")
          jQuery(".j_joblist .checkbox").attr("checked","checked")
        }else{
          jQuery(".j_joblist .e").removeClass("on")
          jQuery(".j_joblist .checkbox").removeAttr("checked")
        }

        if($('input:checkbox[name="delivery_jobid"]:checked').length==0)
          {
              $("div.op span.but_sq,div.op span.but_sc,div.op span.but_sf").addClass("uck");
          }
          else
          {
              $("div.op span.but_sq,div.op span.but_sc,div.op span.but_sf").removeClass("uck");
          }
        //已选数量
        $('.num').text($("input[name='delivery_jobid']:checked").length)
        
        var jtabs = $('.j_tabs');
        if($("input[name='delivery_jobid']:checked").length>0){
          jtabs.show();
        } else {
          jtabs.hide();
        }

    })

}

//扩展职位搜索页面功能
jobs_page_extend = function(result){

  if(document.location.href.indexOf(__str_jobs_url) < 0 ){
    return;
  }

    //增加全选按钮
    var strHtml = `
    <input type="checkbox" id="job_helper_box_select_all"  class="form-check-input"  value="1">
    <label for="job_helper_box_select_all" class="form-check-label">全选</label>  `;

    jQuery(".chall").append(strHtml);

    jQuery("#job_helper_box_select_all").click(function(){
       var bChecked = jQuery(this).is(":checked");
       if(bChecked){
          jQuery(".joblist-item:not(.on)").find(".ick").trigger("click");
       }else{
          jQuery(".joblist-item").find(".ick").trigger("click");
       }
    })

}

//扩展职位申请,翻页后刷新
jobs_page_extend_refresh_list = function(result){

  if(document.location.href.indexOf(__str_jobs_url) < 0 ){
    return;
  }

  //遍历申请列表，增加申请提示信息
  jQuery("a[data-nick='job-detail-job-info']").each(function(){

    //职位id，和职位详情页面并不一致，不能从职位详情链接或职位ID
    var str_job_id = jQuery(this).attr("data-tlg-scm");
    var job_id =  str_job_id.match(/cid=(\d+\_)(\d+)&/)[2];

    if (result){
      if(result[job_id]){
        var strHtml = '<span class="job_helper_box_applyed"  style="height:20px;float:left;" title="点击职位详情页查看最早发布日期">('+result[job_id].update_date + '刷新)</span>';
            jQuery(this).after(strHtml);
      }
    }

    if(__arr_apply_list[job_id]){

      var apply_info    = __arr_apply_list[job_id];
      var publish_date    = apply_info.publish_date;
      var strHtml = '<span class="job_helper_box_applyed" style="height:20px;float:left;" title="点击职位详情页查看最早发布日期">(' + publish_date + '刷新)</span>';
          jQuery(this).after(strHtml);
    }


  });


}


//扩展我的申请,翻页后刷新
apply_page_extend_refresh_list = function(result){

  if(document.location.href.indexOf(__str_apply_url) < 0 ){
    return;
  }

  //遍历申请列表，增加申请提示信息
  jQuery("a[data-nick='job-detail-job-info']").each(function(){

    //职位id，和职位详情页面并不一致，不能从职位详情链接或职位ID
    var str_job_id = jQuery(this).attr("data-tlg-scm");
    var job_id =  str_job_id.match(/cid=(\d+\_)(\d+)&/)[2];

    if(__arr_apply_list[job_id]){

      var apply_info    = __arr_apply_list[job_id];
      var publish_date    = apply_info.publish_date;
      var strHtml = '<span class="job_helper_box_applyed" style="height:20px;float:left;" title="点击职位详情页查看最早发布日期">(' + publish_date + '刷新)</span>';
          jQuery(this).after(strHtml);
    }


  });


}

//扩展谁查看我的页面功能,翻页后刷新
view_page_extend_refresh_list = function(result){

  if(document.location.href.indexOf(__str_view_url) < 0 ){
    return;
  }

  var json_apply_list_by_com = [];
  for(e in __arr_apply_list){
    json_apply_list_by_com[__arr_apply_list[e].company_id] = __arr_apply_list[e];
  }


  //遍历申请列表，增加申请提示信息
  jQuery(".resume-item-time").each(function(){

    let company_id =  jQuery(this).parent().find(".resume-item-desc").eq(0).attr("href").match(/\/(\d+)/)[1];

    if(json_apply_list_by_com[company_id]){

      var apply_info    = json_apply_list_by_com[company_id];

      var apply_date    = apply_info.apply_date;
      var apply_status  = apply_info.apply_status;
      var feedback      = apply_info.feedback;
      var publish_date  = apply_info.publish_date;
      

      var feedback_html = "已申请岗位：<a href='"+ apply_info.job_link + "  '>" + apply_info.job_name + "</a><br/>";

      if(feedback){

        feedback_html += "<ul>";

        for(e in feedback){
          
          feedback_html += "<li>";

          if(feedback[e].createtime){
            feedback_html += "<b>"+ timestamp_to_date(feedback[e].createtime)+":</b>";
          }

          feedback_html += feedback[e].statusInfo;

          feedback_html += "</li>";
        }
       
        feedback_html += "</ul>";

      }

      var strHtml = '<span class="job_helper_box_applyed"  style="height:20px;float:left;" title="点击职位详情页查看最早发布日期">('+publish_date + '刷新,' + apply_date + '申请:'+ apply_status +')</span>';
          strHtml += '<div class="job_helper_box_tips"><div class="job_helper_box_tips_content">'+ feedback_html  +'</div></div>';
          strHtml += '<div style="clear:both"></div>';
          jQuery(this).after(strHtml);

          const popoverTrigger = jQuery(this).parent().find(".job_helper_box_applyed").eq(0)[0];
          const popoverContent = jQuery(this).parent().find(".job_helper_box_tips").eq(0)[0].innerHTML;

          // 初始化 Popover，将内容设置为隐藏元素的 HTML
          const popover = new bootstrap.Popover(popoverTrigger, {
              content: popoverContent,
              html: true,
              trigger: 'manual' // 设置为手动触发
          });

          jQuery(popoverTrigger).hover(
            function() {
                popover.show();
              },
            function() {
                popover.hide();
            }
          );

    }

  });


}

//扩展我收藏页面功能,翻页后刷新
fav_page_extend_refresh_list = function(result){

  if(document.location.href.indexOf(__str_fav_url) < 0 ){
    return;
  }

  //遍历申请列表，增加申请提示信息
  jQuery("a[data-nick='job-detail-job-info']").each(function(){

    //职位id，和职位详情页面并不一致，不能从职位详情链接或职位ID
    var str_job_id = jQuery(this).attr("data-tlg-scm");
    var job_id =  str_job_id.match(/cid=(\d+\_)(\d+)&/)[2];

        if (result){
          if(result[job_id]){
            var strHtml = '<span class="job_helper_box_applyed"  style="height:20px;float:left;" title="点击职位详情页查看最早发布日期">('+result[job_id].publish_date + '刷新)</span>';
                jQuery(this).after(strHtml);
          }
        }

      if(__arr_apply_list[job_id]){

        var apply_info    = __arr_apply_list[job_id];

        var apply_date    = apply_info.apply_date;
        var apply_status  = apply_info.apply_status;
        var feedback      = apply_info.feedback;
        var publish_date      = apply_info.publish_date;

        var feedback_html = "已申请岗位：<a href='"+ apply_info.job_link + "'>" + apply_info.job_name + "</a><br/>";

        if(feedback){

          feedback_html += "<ul>";

          for(e in feedback){
            
            feedback_html += "<li>";

            if(feedback[e].createtime){
              feedback_html += "<b>"+ timestamp_to_date(feedback[e].createtime)+":</b>";
            }

            feedback_html += feedback[e].statusInfo;

            feedback_html += "</li>";
          }
        
          feedback_html += "</ul>";

        }

        var strHtml = '<span class="job_helper_box_applyed"  style="height:20px;float:left;" title="点击职位详情页查看最早发布日期">(' + apply_date + '申请:'+ apply_status +')</span>';
            strHtml += '<div class="job_helper_box_tips"><div class="job_helper_box_tips_content">'+ feedback_html  +'</div></div>';
            strHtml += '<div style="clear:both"></div>';
            jQuery(this).after(strHtml);

            const popoverTrigger = jQuery(this).parent().find(".job_helper_box_applyed").eq(0)[0];
            const popoverContent = jQuery(this).parent().find(".job_helper_box_tips").eq(0)[0].innerHTML;

            // 初始化 Popover，将内容设置为隐藏元素的 HTML
            const popover = new bootstrap.Popover(popoverTrigger, {
                content: popoverContent,
                html: true,
                trigger: 'manual' // 设置为手动触发
            });

            jQuery(popoverTrigger).hover(
              function() {
                  popover.show();
                },
              function() {
                  popover.hide();
              }
            );

      }

  });


}


load_local_data = function(){

    //let page_type = page_type();

    // 异步获取数据
    chrome.storage.local.get(['liepin_apply_list'], function(result) {

      result = result['liepin_apply_list'];

      if(!result){result = {}}

      __arr_apply_list = result;

      jQuery("#job_helper_list_apply .monitor_num").html(Object.keys(result).length);

      fav_page_extend();

      jobs_page_extend();

      setTimeout(function(){
        apply_page_extend_refresh_list();
        view_page_extend_refresh_list();
        fav_page_extend_refresh_list();
      },1000);
    });

    chrome.storage.local.get(['liepin_view_list'], function(result) {
      result = result['liepin_view_list'];
      __arr_view_list = result;

      if(!result){result = {}}
      jQuery("#job_helper_list_view .monitor_num").html(Object.keys(result).length);
    });

    chrome.storage.local.get(['liepin_fav_list'], function(result) {
      result = result['liepin_fav_list'];
      __arr_fav_list = result;

      if(!result){result = {}}
      jQuery("#job_helper_list_fav .monitor_num").html(Object.keys(result).length);
    });

    //如果点击了已申请列表收藏列表，由于是同一页，需要重新加载一下Css样式
    jQuery("#rc-tabs-0-tab-apply,#rc-tabs-0-tab-favorite").click(function(){
      let action =  jQuery(this).attr("id").split("-");
      document.location.href = 'https://c.liepin.com/job/record/'+ action[action.length-1];
    });
    
    //如果是职位详细信息页面，展示发布时间和更新时间
    if(document.location.href.toString().match(/liepin\.com\/job\/\d+\.shtm|liepin\.com\/a\/\d+\.shtm/)){

      var scriptTag = document.querySelector('script[type="application/ld+json"]');

      // 读取<script>标签的内容
      var jsonStr = scriptTag.textContent;
      
      // 解析JSON字符串为JavaScript对象
      var jsonObject = JSON.parse(jsonStr);
      
      let strHTML = `
                    <span class="btn btn-warning  btn-sm">发布时间:`+ jsonObject.pubDate.slice(0, 16).replace('T',' ') +`</span>&nbsp;
                    <span class="btn btn-primary  btn-sm">更新时间:`+  jsonObject.upDate.slice(0, 16).replace('T',' ')  +`</span>
                    `;
      jQuery(".salary").after(strHTML);
      //iepin.com/job/1926096983.shtml

    }
}

//ajax调用后的hook
ajax_hook = function(e){

    let url = e.data.url;
    let response = e.data.response;

    console.log(url);

    if(url){

        //判断指定ajax请求,如果实现的是职位搜索列表，等页面渲染完成后，再附加扩展功能需要呈现的功能

        //获取谁看过我,排除掉插件自己访问的src=get_view_info
        if(url.indexOf('https://api-c.liepin.com/api/com.liepin.cresume.user.resume-viewed-page') >= 0  && url.indexOf('get_view_info') < 0  ){
    
          var jsonRst = {}
          var result  = JSON.parse(response);
              result  = result.data.list;
              result  = parse_view_info(result);
    
            for(var i=0; i< result.length; i++){
                jsonRst[result[i].job_id] = result[i];
            }

            setTimeout(function() {
              view_page_extend_refresh_list(jsonRst);
            } ,500);
  
        }

        //我的收藏,排除掉插件自己访问的src=get_fav_info
        if(url.indexOf('https://api-c.liepin.com/api/com.liepin.c.job-favorite.get-favorite-job-page') >= 0  && url.indexOf('get_fav_info') < 0  ){
          var jsonRst = {}
          var result  = JSON.parse(response);
              result  = result.data.datas;
              result  = parse_fav_info(result);

              for(var i=0; i< result.length; i++){
                jsonRst[result[i].job_id] = result[i];
              }

              setTimeout(function() {
                fav_page_extend_refresh_list(jsonRst);
              } ,500);
        }

        //我的申请,排除掉插件自己访问的src=get_apply_info
        if(url.indexOf('https://api-c.liepin.com/api/com.liepin.capply.pc.apply-list') >= 0  && url.indexOf('get_apply_info') < 0  ){

          var jsonRst = {}
          var result  = JSON.parse(response);
              result  = result.data.list;
              result  = parse_apply_info(result);

              for(var i=0; i< result.length; i++){
                jsonRst[result[i].job_id] = result[i];
              }

            setTimeout(function() {
              apply_page_extend_refresh_list(jsonRst);
            } ,500);
        }

        //职位列表
        if(url.indexOf('https://api-c.liepin.com/api/com.liepin.searchfront4c.pc-search-job') >= 0 ){

          var jsonRst = {}
          var result  = JSON.parse(response);
              result  = result.data.data.jobCardList;
              result  = parse_jobs_info(result);

              for(var i=0; i< result.length; i++){
                jsonRst[result[i].job_id] = result[i];
              }

            setTimeout(function() {
              jobs_page_extend_refresh_list(jsonRst);
            } ,500);
        }
        

    }

}


